//////////////////////////////////////////////////////////////////////////
#pragma once
//////////////////////////////////////////////////////////////////////////
#include "CompositeObject/CompositeObject.h"
#include "MainHelpers/MainHelpers.h"
#include <vector>
#include "Functor/Functor.h"
//////////////////////////////////////////////////////////////////////////
class HotSpot: public CompositeObject
{
public:
	HotSpot();
	~HotSpot();

	void				addPoint(const hlp::Pointf& point);
	void				addPoint(float x, float y);
	void				clearPoints();
	void				update(float dt);
	void				updateTransformationMatrix();
	bool				checkMouseEvent(int buttonNumber, bool isDown);
	bool				checkMouseIn();
	void				setParent(CompositeObject* parent);
	void				setMouseEventListener(FunctorArg<bool, bool>* functor){m_mouseEventFunctor = functor;};
	void				setMouseEnterListener(Functor<bool>* functor)         {m_mouseEnterFunctor = functor;};
	void				setMouseLeaveListener(Functor<bool>* functor)         {m_mouseLeaveFunctor = functor;};

private:
	void				transformatePoints();
	bool				testPoint(const hlp::Pointf& point);

private:
	std::vector<hlp::Pointf>		m_points;
	std::vector<hlp::Pointf>		m_transformedPoints;
	FunctorArg<bool, bool>*		    m_mouseEventFunctor;
	Functor<bool>*				    m_mouseEnterFunctor;
	Functor<bool>*				    m_mouseLeaveFunctor;
	bool							m_mouseInside;
};
//////////////////////////////////////////////////////////////////////////